#include<bits/stdc++.h>
#define int long long
#define N 50
#define base 131
//#define mod 998244353
using namespace std;

int n = 1, m, a, b, ans;
int col1[N], col2[N][N], h1[N], h2[N], h3[N], h4[N];

int P[N * N], id[N][N], tot;

int d(int i, int j) {
	return min(j - i, i + n - j);
}
struct node {
	int A, B, C, D, E;
}z[N * N];
unordered_map<int, bool>f;
//map<vector<node>, bool>f;

bool cmp(node x, node y) {
	if(x.A != y.A) return x.A < y.A;
	else if(x.B != y.B) return x.B < y.B;
	else if(x.C != y.C) return x.C < y.C;
	else if(x.D != y.D) return x.D < y.D;
	else return x.E < y.E;
}
void dfs2(int k) {
	if(k > tot) {
		int num = 0, sum = 0;
		for(int i = 1; i < n; i++)
		for(int j = i + 1; j <= n; j++) {
			num++;
			
			int ok1 = 0;
			for(int t = i; t <= j; t++) ok1 = ok1 * base + col1[t];
			int ok2 = 0;
			for(int t = i; t >= 1; t--) ok2 = ok2 * base + col1[t];
			for(int t = n; t >= j; t--) ok2 = ok2 * base + col1[t];
			
			z[num] = ((node){min(col1[i], col1[j]), max(col1[i], col1[j]), d(i, j), P[num], min(ok1, ok2)});
		}
		sort(z + 1, z + num + 1, cmp);
		for(int i = 1; i <= num; i++) {
			sum = sum * base + z[i].A;
			sum = sum * base + z[i].B;
			sum = sum * base + z[i].C;
			sum = sum * base + z[i].D;
			sum = sum * base + z[i].E;
			//cout << z[i].A << " " << z[i].B << " " << z[i].C << " " << z[i].D << " " << z[i].E << endl;
		}
		//cout << " : " << sum << endl;
		//cout << endl;
		if(f[sum]) return;
		f[sum] = 1;
		ans++;
		return;
	}
	for(int i = 1; i <= b; i++) {
		P[k] = i;
		dfs2(k + 1);
	}
}

void dfs1(int k) {
	if(k > n) {
		dfs2(1);
		return;
	}
	for(int i = 1; i <= a; i++) {
		col1[k] = i;
		dfs1(k + 1);
	}
}
signed main() {
	freopen("clown.in", "r", stdin);
	freopen("clown.out", "w", stdout);
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	
	cin >> m;
	for(int i = 1, x; i <= m; i++) {
		cin >> x;
		n *= x;
	}
	cin >> a >> b;	
	for(int i = 1; i < n; i++)
	for(int j = i + 1; j <= n; j++) id[i][j] = ++tot;
	dfs1(1);
	
	cout << ans / 2;
	return 0;
}

/*
1
3
2 2

*/
